#ifndef _BrokerServantImp_H_
#define _BrokerServantImp_H_

#include "servant/Application.h"
#include "BrokerServant.h"
#include "gamoosim.h"
#include <map>
/**
 *
 *
 */
class BrokerServantImp : public gamoosim::BrokerServant
{
public:
    /**
     *
     */
    virtual ~BrokerServantImp() {}

    /**
     *
     */
    virtual void initialize();

    /**
     *
     */
    virtual void destroy();

    /**
     *
     */
    virtual int test(tars::TarsCurrentPtr current) { return 0;};
protected:
    int doRequest(tars::TarsCurrentPtr current, vector<char>& response);
    int doClose(TarsCurrentPtr current);
   
    void processReqRPC(tars::TarsCurrentPtr current, const Toon::ClientContext &context, const gamoosim::ABCPack &req);

    void processLoginReq(tars::TarsCurrentPtr current, const Toon::ClientContext &context, const gamoosim::ABCPack &req);
    void processKickoutReq(tars::TarsCurrentPtr current, const Toon::ClientContext &context, const gamoosim::ABCPack &req);
    void processLogoutReq(tars::TarsCurrentPtr current, const Toon::ClientContext &context, const gamoosim::ABCPack &req);
    void processPingReq(tars::TarsCurrentPtr current, const Toon::ClientContext &context, const gamoosim::ABCPack &req);

    std::map<int, std::string> _mapServerName;//保存服务名称跟type的对应关系
};
/////////////////////////////////////////////////////


#endif
